/**
 * TmPackFactoryDaoImpl.java
 * Created at 2017-3-14
 * Created by xieshuang
 * Copyright (C) 2017 BROADTEXT SOFTWARE, All rights reserved.
 */
package com.broadtext.rms.basic.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.broadtext.common.exp.DaoException;
import com.broadtext.common.repository.EntityDao;
import com.broadtext.rms.basic.dao.ITmPackFactoryDao;
import com.broadtext.rms.basic.model.TmPackFactory;

/**
 * <p>ClassName: TmPackFactoryDaoImpl</p>
 * <p>Description: 电池pack生产厂dao实现类</p>
 * <p>Author: xieshuang</p>
 * <p>Date: 2017-3-14</p>
 */
@Repository("tmPackFactoryDao")
public class TmPackFactoryDaoImpl extends EntityDao<TmPackFactory> implements ITmPackFactoryDao {
    /**
     * 
     * <p>Description: 验证是否唯一</p>
     * @param code 厂区编码
     * @return 判断结果
     * @throws DaoException 异常
     */
    public boolean isOnly(TmPackFactory t) throws DaoException {
        List<TmPackFactory> packList;
        packList = this.getCurrentSession().selectList("com.broadtext.rms.basic.model.TmPackFactory.isOnly",t);
        if(packList.isEmpty()){
            //唯一
            return true;
        } else {
            //不唯一
            return false;
        }
    }
    
    
    /**
     * 
     * <p>Description: 根据主键获取对象</p>
     * @param id 主键
     * @return 对象
     * @throws DaoException 异常
     */
    public TmPackFactory getPackFactoryById(String id) throws DaoException {
        return (TmPackFactory) this.getCurrentSession()
                .selectList("com.broadtext.rms.basic.model.TmPackFactory.findEntityById", id).get(0);
    }
}
